package com.turing.draw.enums;

import lombok.Getter;

/**
 * @author Maven
 * @version V1.0
 * @Package com.example.demo
 * @date 2021/4/15 11:30
 * @Copyright © 2020 深圳市图灵机器人有限公司
 */
public enum FileStatusEnum {

    /**
     * 上传
     */
    UPLOADED(0, "uploaded"),
    /**
     * 前置任务处理
     */
    PRETASKPROCESSING(1, "pre task processing"),
    /**
     * 预任务完成
     */
    PRETASKFINISHED(2, "pre task finished"),
    /**
     * ocr任务处理
     */
    OCRTASKPROCESSING(3, "ocr task processing"),
    /**
     * ocr任务完成
     */
    OCRTASKFINISHED(4, "ocr task finished"),
    /**
     * 绘制任务处理
     */
    FORECASTTASKPROCESSING(5, "draw task processing"),
    /**
     * 绘制任务完成
     */
    FORECASTTASKFINISHED(6, "draw task finished"),
    /**
     *审查完成
     */
    REVIEWFINISHED(7, "review finished"),
    /**
     * 绘制任务失败
     */
    FAILED(8, "draw task failed"),
    /**
     * 混合场景处理
     */
    MERGETEMPLATEPROCESSING(10, "merge template processing"),
    /**
     * 混合场景完成
     */
    MERGETEMPLATEFINISHED(11, "merge template finished"),
    /**
     * 失败
     */
    NOTEXIST(-1, "failed");

    @Getter
    private Integer code;

    @Getter
    private String name;

    FileStatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static FileStatusEnum getEnum(Integer index) {
        FileStatusEnum[] fileStatusEnums = FileStatusEnum.values();
        for (FileStatusEnum anFileStatusEnum : fileStatusEnums) {
            if (index.equals(anFileStatusEnum.getCode())) {
                return anFileStatusEnum;
            }
        }
        return null;
    }

}
